home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows5 / wbb11.zip / BB.DOC next >
Text File  |  1992-05-15  |  61KB  |  2,509 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           BasicBasic is copyright (c) 1992 by Mark Davidsaver.  All
  8.           rights reserved.
  9.  
  10.  
  11.           ORDER INFORMATION
  12.           -------------------------------------------------------
  13.  
  14.           If you find BasicBasic useful registration is requested.
  15.           Through August 31, 1992, the registration fee is $15.00.
  16.           After that date the fee is $30.00.  Registration includes
  17.           one free upgrade to the software and documentation.
  18.           Please state the version of the software that you
  19.           currently have and whether 3 1/2 or 5 1/4 diskettes are
  20.           needed.  Illinois residents add 6.25% sales tax.
  21.  
  22.           Send check or money order to:  Mark Davidsaver
  23.                                          213 S. Park Street
  24.                                          Bishop Hill, Il  61419
  25.  
  26.           or phone with MC/Visa orders to:  (309) 927-3303
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.                                TABLE OF CONTENTS
  77.  
  78.  
  79.                 Summary ................................ 2
  80.  
  81.                 Getting Started Quickly ................ 3
  82.  
  83.                 BasicBasic Basics ...................... 5
  84.  
  85.                 Windows Metacommands ................... 7
  86.  
  87.                 Metacommands ........................... 8
  88.  
  89.                 Statement and Function Reference ....... 9
  90.  
  91.                 Windows and Fonts ...................... 25
  92.                  (386 Enhanced Mode Font information)
  93.  
  94.                 Programming Buttons .................... 27
  95.  
  96.                 Programming Menus ...................... 29
  97.  
  98.                 Communications Programming ............. 31
  99.  
  100.                 Chaining and Common .................... 32
  101.  
  102.                 Errors ................................. 33
  103.  
  104.                 Keyboard codes ......................... 35
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                       1
  128.  
  129.  
  130.  
  131.  
  132.  
  133.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.           SUMMARY
  141.           -------------------------------------------------------
  142.  
  143.           BasicBasic is an easy to program, Basic-like language for
  144.           DOS or Windows.  BasicBasic contains a subset of Microsoft
  145.           Basic as well as many new commands unique to BasicBasic.
  146.           BasicBasic is an easy way to develop small to medium size
  147.           programs without regard for which environment they will
  148.           run under.  BasicBasic supports mouse and buttons in both
  149.           DOS and Windows and Menus in Windows.  Several commands
  150.           from more advanced Basics are also included (such as the
  151.           DIR$ function and binary file I/O from Microsoft
  152.           Professional Basic).  Programs written for BasicBasic can
  153.           run under either DOS or Windows.  The compiler, itself,
  154.           may run under either DOS or Windows.
  155.  
  156.           In addition to BasicBasic you will need a source editor
  157.           for the environment you are running under.  BasicBasic
  158.           accepts source from standard ASCII files.
  159.  
  160.           Here is a list of statements and functions the BasicBasic
  161.           compiler recognizes.  Refer to the detailed description
  162.           later on for the exact syntax recognized.
  163.  
  164.           ABS   ADDSUBMENU   ASC   BEEP   CBUTTON   CHAIN   CHR$
  165.           CLOSE   CLS   COLOR   COMMON   COMSTATI   CSRLIN   DATA
  166.           DATE$   DBUTTON  DIM   DIR$   EOF   FIELD   FIX
  167.           FOR..NEXT   FREEMEM   GET #   GOSUB..RETURN   GOTO
  168.           IF..THEN..ELSE   INKEY$   INPUT   INPUT #   INPUT$   INSTR
  169.            INT   KILL   LEFT$   LEN   LET   LINE INPUT #   LOC
  170.           LOCATE   LSET   MAINMENU   MENUITEMGRAY   MENUITEMON
  171.           MID$   MKDIR   MOUSEB  MOUSEON   MOUSEX   MOUSEY   OPEN
  172.           OPEN "COMn:"   POS   PRINT   PRINT #   LPRINT   PRINT
  173.           USING  PUT #   LPRINT USING   OSTYPE   RADIOON   RADIOOFF
  174.           READ   REM   RESTORE   RETURN   RIGHT$   RMDIR   RND
  175.           SCROLLAREA   SETERRLEVEL   SPACE$   STOP   STR$   STRING$
  176.           TAB   TIME$  TIMER   UCASE$   VAL   WRITE #
  177.  
  178.           and the operators     +  -  /  *  \  ^  AND  OR
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                       2
  194.  
  195.  
  196.  
  197.  
  198.  
  199.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.           GETTING STARTED QUICKLY
  207.           -------------------------------------------------------
  208.  
  209.           The easiest way to run BasicBasic is to have all required
  210.           files in one directory.  If you are not going to be
  211.           running or compiling under either DOS or Windows you do
  212.           not need the files specific to them.  BasicBasic files
  213.           required for each operating environment are:
  214.  
  215.                      FILE        USE
  216.                      _____       __________________________________
  217.  
  218.                      BB.EXE   \_ required to compile under DOS
  219.                    BB11.STB   /
  220.  
  221.                 BBLIB11.EXE    _ runtime required to run application
  222.                                  under DOS
  223.  
  224.  
  225.                     WBB.EXE   \_ required to compile under Windows
  226.                    BB11.STB   /
  227.  
  228.                WBBLIB11.EXE    _ runtime required to run application
  229.                                  under Windows
  230.  
  231.           You may also want the provided sample programs.
  232.           (SAMPLE1.BAS, SAMPLE2.BAS, etc.)
  233.  
  234.           Before compiling a program you must have the Source in an
  235.           ASCII file.  Most word processors have an option to allow
  236.           reading/writing of ASCII files.  Windows Write, for
  237.           example, allows you to save in Text Only format which is
  238.           ASCII.  When opening ASCII files you must be sure to tell
  239.           Write to NOT convert file to Write format.
  240.  
  241.           Several sample programs are provided to let you get
  242.           started quickly.  These are named SAMPLE1.BAS,
  243.           SAMPLE2.BAS, etc.
  244.  
  245.           To compile a program under DOS type BB.  When requested
  246.           enter the file name you want to compile.  If no extension
  247.           is given the compiler will assume .BAS.  You can also
  248.           enter the file name you want to compile as part of the
  249.           start command.  e.g.   BB SAMPLE1.BAS.  The executable
  250.           file created will have the same name as the source file.
  251.  
  252.           Under Windows you must compile using the program WBB.EXE.
  253.           You may install this in a group with the Program Manager
  254.           or run WBB seperately.  When compile is completed you may
  255.           either execute the program or restart to compile another
  256.           program.
  257.  
  258.           IMPORTANT!  Whether you are compiling under DOS or Windows
  259.                                       3
  260.  
  261.  
  262.  
  263.  
  264.  
  265.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  266.  
  267.  
  268.  
  269.  
  270.  
  271.           only one EXE file will be created.  This file will have
  272.           the same name as the source file with an extenstion of
  273.           .EXE.  This EXE file can be executed under either DOS or
  274.           Windows as long as the appropriate runtime module is
  275.           present (BBLIB11.EXE for DOS or WBBLIB11.EXE for Windows).
  276.  
  277.           DOS programs require the presence of BBLIB11.EXE to run
  278.           and Windows programs require the presence of WBBLIB11.EXE
  279.           to run.  If this runtime library file is not found an
  280.           error message will be returned (In Windows the absence of
  281.           WBBLIB11.EXE is indicated by 4 short beeps and the program
  282.           does not execute).
  283.  
  284.           If you are running Windows 3.1 in 386 Enhanced Mode see
  285.           the section on Windows and Fonts for important information
  286.           on using different font sizes.
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                       4
  326.  
  327.  
  328.  
  329.  
  330.  
  331.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.           BasicBasic Basics
  339.           -------------------------------------------------------
  340.  
  341.           BasicBasic is intended to be a subset of Microsoft Basic.
  342.           More statements and functions will be added with each
  343.           release.  Depending on your religion you may or may not be
  344.           happy to see that GOTO is supported.  BasicBasic's syntax
  345.           is 'almost' the same as Microsoft's Basic.  Here are some
  346.           known syntax differences:
  347.  
  348.                BasicBasic scans expressions from left to right the
  349.                same as Microsoft Basic, however, BasicBasic checks
  350.                all multiplies before divides and all minus signs
  351.                before addition.
  352.  
  353.                BasicBasic does not support the underscore (_) line
  354.                extension character.
  355.  
  356.           Most functions and statements have the same syntax as
  357.           Microsoft Basic.  You should check the Statement and
  358.           Function Reference section for details on syntax for the
  359.           following commands/functions which may differ from
  360.           Microsoft Basic or which are unique to BasicBasic.
  361.  
  362.              CLOSE    CLS   COLOR    COMMON DIR$   FREEMEM   GET #
  363.              INPUT$
  364.              LOCATE   LPRINT USING   OPEN   PRINT USING
  365.              PUT #   RETURN   RND   SETCOM   SETERRLEVEL   STRING$
  366.  
  367.           Double precision numbers are not supported in this
  368.           version.
  369.  
  370.           BasicBasic does not support a standard array of size 10.
  371.           Every array must be explicitly dimensioned with a DIM
  372.           statement.
  373.  
  374.           CAPACITIES
  375.  
  376.                Maximum number of arrays:  100
  377.                        Total open files:  10
  378.                      Total string space:  approximately 47000 chars.
  379.           Maximum character string size:  2048
  380.                         Maximum Buttons:  40
  381.                           Maximum menus:  6
  382.                 Maximum Items in a menu:  10
  383.  
  384.  
  385.  
  386.           RESERVED WORDS
  387.  
  388.           All names of statements and functions are reserved words
  389.           and may not be used as variable names.  ERR is a special
  390.           case.  This is a system wide variable used to return error
  391.                                       5
  392.  
  393.  
  394.  
  395.  
  396.  
  397.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  398.  
  399.  
  400.  
  401.  
  402.  
  403.           information to BasicBasic programs.  See the command
  404.           SETERRLEVEL for more complete information.
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                       6
  458.  
  459.  
  460.  
  461.  
  462.  
  463.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.           WINDOWS METACOMMANDS
  471.           -------------------------------------------------------
  472.  
  473.  
  474.           BasicBasic contains several Metacommands to set Windows
  475.           environment parameters.  These commands have no affect on
  476.           execution of the program.  All Windows Metacommands have
  477.           the following format:
  478.  
  479.                  REM WINDOWS command
  480.  
  481.           REM WINDOWS NAME name
  482.  
  483.           The window name which the program will display can be
  484.           supplied.  The default is the same as the file name of the
  485.           program.
  486.                    e.g.   REM WINDOWS NAME investments
  487.  
  488.  
  489.           REM WINDOWS size x1,y1,x2,y2
  490.  
  491.           This command allows you to define a portion of the normal
  492.           DOS screen size as the area to be displayed in the Windows
  493.           window.  This is useful if you have a program centered in
  494.           the standard 80x25 DOS screen, but do not use much of the
  495.           border area.  Regular scrolling may not work in windows if
  496.           you define the window size as less than 80x25.  X1 is the
  497.           left column, y1 is the top row, x2 is the right column,
  498.           and y2 is the bottom row.  e.g.
  499.  
  500.                    e.g.       REM WINDOWS SIZE 10,10,70,15
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.                                       7
  524.  
  525.  
  526.  
  527.  
  528.  
  529.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.           METACOMMANDS
  537.           -------------------------------------------------------
  538.  
  539.           metacommands are preceded by REM and a dollar sign.
  540.  
  541.  
  542.           INCLUDE:
  543.  
  544.             This metacommand allows you to include source from
  545.             another file in the currently compiling file.  files may
  546.             be nexted up to 10 levels deep.
  547.  
  548.               e.g.  REM $INCLUDE: moretext.asc
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                       8
  590.  
  591.  
  592.  
  593.  
  594.  
  595.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.           STATEMENT AND FUNCTION REFERENCE
  603.           -------------------------------------------------------
  604.  
  605.           Here is a brief description of available functions and
  606.           statements.  More detailed information on those not unique
  607.           to BasicBasic can be found in standard Basic reference
  608.           books.
  609.  
  610.  
  611.  
  612.           ABS(numericexpression)
  613.  
  614.             This function returns the absolute value of the numeric
  615.             expression.
  616.  
  617.  
  618.  
  619.           ADDSUBMENU  menunumber,stringexpression,keycode
  620.  
  621.             This command is ignored in DOS.  Addsubmenu adds an item
  622.             to a pull down menu with the text stringexpression.
  623.             When the user selects this menu item the keycode will be
  624.             returned at the next INKEY$ function call.  See the
  625.             section 'Programming Menus' for more details
  626.  
  627.  
  628.  
  629.           ASC(string expression)
  630.  
  631.             This function returns a numerical value which is the
  632.             ASCII code for the first character of string expression.
  633.  
  634.  
  635.  
  636.           BEEP
  637.  
  638.             This statement sounds the ASCII bell character.
  639.  
  640.  
  641.  
  642.           CBUTTON "name",keycode,0,"type",0,left,top,xsize,ysize,
  643.                   forecolor,backcolor
  644.  
  645.             This command defines and creates a button on screen.
  646.             This command is DOS and Windows compatible.  The name is
  647.             the text which will be displayed in the button.  When
  648.             you define a button you must define the keycode which
  649.             will be returned when that button is pressed by the
  650.             user.  Legal button types are "Radio", "Push" or
  651.             "Invisible".  Left, top, xsize, ysize define the
  652.             position and size of the button(in character position).
  653.             Radio buttons may have a foreground and background color
  654.             defined.  If these are left 0 then the default colors
  655.                                       9
  656.  
  657.  
  658.  
  659.  
  660.  
  661.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  662.  
  663.  
  664.  
  665.  
  666.  
  667.             will be used.  In DOS the colors are also used for
  668.             Pushbuttons.
  669.  
  670.             When the user presses the button the indicated keycode
  671.             will be returned to the INKEY$ function.  If a button is
  672.             pressed while executing the INPUT command the input will
  673.             be ended, but the keycode will not be returned until a
  674.             subsequent INKEY$ function is called.  Instead of using
  675.             the mouse to press the indicated button, the user can
  676.             also press the keyboard key which returns the indicated
  677.             keycode.
  678.  
  679.             Any key may be defined for a button.  See the section
  680.             "Keyboard codes" for a list of codes recognized by
  681.             BasicBasic.  As an example the uppercase letter 'A'
  682.             would be the keycode 65.  Extended keycodes are
  683.             indicated by adding 1000 to the second part of the code.
  684.             For example F1 would be 1059, or F10 would be 1068.
  685.  
  686.               e.g. CBUTTON "Exit",1068,"Push",0,1,1,8,1,7,4
  687.  
  688.                    Creates a push button on the top line.  Because
  689.                    it is a Push button the color values are ignored
  690.                    in windows, but used in DOS.
  691.  
  692.             See RADIOON and RADIOOFF for instructions on
  693.             checking/unchecking radio buttons.
  694.  
  695.             See the section "Programming Buttons" for more detail on
  696.             programming buttons.
  697.  
  698.             Note that while CBUTTON creates a button it will not
  699.             respond to the mouse button until the function MOUSEON
  700.             has been issued.
  701.  
  702.  
  703.  
  704.           CHAIN  filespec
  705.  
  706.             This command transfers control from the current program
  707.             to another program.  COMMON may be used to pass
  708.             variables between programs.  Files are left open when
  709.             transfering to another program.  See the section
  710.             'Chaining and Common' for more details.
  711.  
  712.                 e.g.  CHAIN "TEST2.EXE"
  713.  
  714.  
  715.  
  716.           CHR$(numeric expression)
  717.  
  718.             This function returns the ASCII code for the numeric
  719.             expression.  The returned code is one character.
  720.  
  721.                                       10
  722.  
  723.  
  724.  
  725.  
  726.  
  727.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.           CLOSE #filenumber
  736.  
  737.             This statement terminates I/O to the indicated
  738.             filenumber.  Only one number allowed for each CLOSE
  739.             command.
  740.  
  741.  
  742.  
  743.           CLS
  744.  
  745.             This statement clears the screen.  If a scrollable area
  746.             has been define the entire screen is still cleared.
  747.  
  748.  
  749.  
  750.           COLOR foreground,background
  751.  
  752.             This statement sets the screen colors to the indicated
  753.             foreground and background colors.  Color values are:
  754.  
  755.                0 - Black
  756.                1 - Blue
  757.                2 - Green
  758.                3 - Cyan
  759.                4 - Red
  760.                5 - Magenta
  761.                6 - Brown
  762.                7 - White
  763.                8 - Gray
  764.                9 - Light Blue
  765.               10 - LIght Green
  766.               11 - Light Cyan
  767.               12 - Light Red
  768.               13 - Light Magenta
  769.               14 - Yellow
  770.               15 - High intensity white
  771.  
  772.             Foreground values can be 0 through 7 and background
  773.             values can be 0 through 15.
  774.  
  775.  
  776.  
  777.           COMMON  variablelist
  778.  
  779.             Common passes variables to a chained program.
  780.             Variablelist is a list of variables and arrays whose
  781.             contents will be preserved when Chaining to a new
  782.             program.  Only 'blank' common is supported.  A blockname
  783.             is not allowed.  the SHARED attribute is not allowed.
  784.             Arrays are indicated by blank parenthesis.  See the
  785.             section 'Chaining and Common' for more details.
  786.  
  787.                                       11
  788.  
  789.  
  790.  
  791.  
  792.  
  793.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  794.  
  795.  
  796.  
  797.  
  798.  
  799.               e.g.  COMMON A,B,A$,B$()
  800.  
  801.  
  802.  
  803.           COMSTATI(comnum)
  804.  
  805.             This function returns the status of a communications
  806.             port.  8 bits of data are returned.  These are defined
  807.             as follows:
  808.  
  809.               bit 7 = Data Carrier Detect
  810.                   6 = Ring Indicator
  811.                   5 - Data Set Ready
  812.                   4 - Clear to Sent
  813.                   3 - Break Detect
  814.                   2 - Framing Error
  815.                   1 - Parity Error
  816.                   0 - Overrun Error
  817.  
  818.               e.g.  a=COMSTATI(1)
  819.  
  820.  
  821.  
  822.           CSRLIN
  823.  
  824.             This function gets the current line position of the
  825.             cursor.
  826.  
  827.  
  828.  
  829.           DATA
  830.  
  831.             This statement is used in conjuction with the READ
  832.             statement to input numeric or string constants.
  833.  
  834.  
  835.  
  836.           DATE$
  837.  
  838.             This function returns a string of ten characters
  839.             corresponding to the current computer date.
  840.  
  841.  
  842.  
  843.           DBUTTON keycode
  844.  
  845.             This statement erases a button from the screen (using
  846.             currently define colors) and disables input from it.
  847.             The keycode should be the same as that used in the
  848.             CBUTTON command.  See the section "Programming Buttons"
  849.             for more information on buttons.
  850.  
  851.  
  852.  
  853.                                       12
  854.  
  855.  
  856.  
  857.  
  858.  
  859.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  860.  
  861.  
  862.  
  863.  
  864.  
  865.           DIM variable(subscripts),...
  866.  
  867.             Defines arrays.  There is no default array size of 10 in
  868.             BasicBasic.  Every array must be defined.  SHARED is not
  869.             supported.
  870.  
  871.  
  872.  
  873.           DIR$(path,[type])
  874.               or
  875.           DIR$
  876.  
  877.             This function returns file names.  If no type is
  878.             specified or type is set to 0 then file names not
  879.             including system and hidden will be returned.  If no
  880.             path is specified then the next name using the previous
  881.             search path will be returned.  Type may be set to a
  882.             non-zero value to return the names of special classes of
  883.             files.
  884.  
  885.                       type       file type
  886.                        1         Read Only files
  887.                        2         Hidden files
  888.                        3         System files
  889.                        5         Directories
  890.                        6         Archive bit set
  891.  
  892.  
  893.  
  894.           EOF(filenumber)
  895.  
  896.             This function tests for end-of-file.
  897.  
  898.  
  899.  
  900.           FIELD #filenumber,fieldwidth AS stringvariable...
  901.  
  902.             This statement allocates space for variables in
  903.             random-access file buffer.  The filenumber is the number
  904.             under which the file was opened.  Fieldwidth is a number
  905.             indicating the length of the field and string variable
  906.             is the name of the field.  Multiple fields can be
  907.             defined at once.
  908.  
  909.                e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  910.                      FIELD #1,18 AS NAME$,18 AS ADDRESS$
  911.                      LSET NAME$="FRED SMITH"
  912.                      LSET ADDRESS$="1 MAIN STREET"
  913.                      PUT #1,1
  914.                      CLOSE #1
  915.  
  916.  
  917.  
  918.           FIX(numeric expression)
  919.                                       13
  920.  
  921.  
  922.  
  923.  
  924.  
  925.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.             This function returns the integer representation of the
  933.             value in numeric expression.  -n.x returns n-1 if x>0.
  934.  
  935.  
  936.  
  937.  
  938.           FOR..NEXT
  939.  
  940.           FOR counter=start TO end [STEP increment]
  941.  
  942.             Defines a program loop.
  943.  
  944.  
  945.  
  946.           FREEMEM
  947.  
  948.             This function returns the amount of global memory
  949.             available to other programs.
  950.  
  951.  
  952.  
  953.           GET #filenumber,recordnumber,variable$
  954.  
  955.             This statement allows input of data from BINARY files.
  956.             Recordnumber is an absolute byte position in the file.
  957.             The first byte of the file is number 1.
  958.  
  959.  
  960.  
  961.           GOSUB label
  962.  
  963.             This statement causes a branch to a subroutine.
  964.  
  965.  
  966.           GOTO label
  967.  
  968.             This statement causes a jump to another program
  969.             location.
  970.  
  971.  
  972.  
  973.           IF...THEN...ELSE
  974.  
  975.             Permits conditional execution depending on evaluation of
  976.             expression.
  977.  
  978.  
  979.  
  980.           INKEY$
  981.  
  982.             This function returns a character from the keyboard.
  983.  
  984.  
  985.                                       14
  986.  
  987.  
  988.  
  989.  
  990.  
  991.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.           INPUT[;]["promptstring"{;|,}] variablelist
  999.  
  1000.             Executing this statement causes the program to pause and
  1001.             wait for input.  A promptstring may optionally be
  1002.             printed before pausing for input.  If a comma is used
  1003.             after the promptstring or if no prompt string is
  1004.             specified a question mark is displayed before waiting
  1005.             for input.  If INPUT is followed by a semicolon, then no
  1006.             carriage return line feed is performed after the Enter
  1007.             key is pressed.
  1008.  
  1009.  
  1010.  
  1011.           INPUT #filenumber,variablelist
  1012.  
  1013.             This statement reads items from an open file to the
  1014.             given variables.  When inputting data leading spaces
  1015.             will be ignored.
  1016.  
  1017.  
  1018.  
  1019.           INPUT$(n,port)
  1020.  
  1021.             This function returns a string of n characters from a
  1022.             communications port.  If n characters are not available
  1023.             the function will WAIT for that many characters to
  1024.             arrive.  To avail 'hanging up' your program use the LOC
  1025.             function to find how many characters are waiting.  If a
  1026.             communications error occurs the number of characters
  1027.             returned may be less than what you requested.  In this
  1028.             case use the function COMSTATI to determine what error
  1029.             occured.  See the section "Communications Programming"
  1030.             for more details.
  1031.  
  1032.  
  1033.  
  1034.           INSTR([start],expressiontosearch,searchforexpression)
  1035.  
  1036.             This function searches for the first occurence of
  1037.             searchforexpression in expressiontosearch and returns
  1038.             the position at which the match is found.  If no match
  1039.             is found then 0 is returned.
  1040.  
  1041.  
  1042.  
  1043.           INT(numericexpression)
  1044.  
  1045.             This function returns the largest integer less than or
  1046.             equal to numericexpression.
  1047.  
  1048.  
  1049.  
  1050.           KILL stringexpression
  1051.                                       15
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.             This command deletes the file whose name is in
  1065.             stringexpression.
  1066.  
  1067.  
  1068.  
  1069.           LEFT$(stringexpression,n)
  1070.  
  1071.             This function returns a string of length n from the left
  1072.             part of stringexpression
  1073.  
  1074.  
  1075.  
  1076.           LEN(stringexpression)
  1077.  
  1078.             This function returns the number of characters in
  1079.             stringexpression.
  1080.  
  1081.  
  1082.  
  1083.           LET
  1084.  
  1085.             May optionally be used before assignment statements.
  1086.             e.g. LET I=3
  1087.  
  1088.  
  1089.  
  1090.           LINE INPUT #,filenumber,stringvariable
  1091.  
  1092.             This statement inputs an entire line from a file.  Input
  1093.             continues until the next carriage return.
  1094.  
  1095.  
  1096.  
  1097.           LOC(filenumber)
  1098.  
  1099.             This function returns the current absolute byte position
  1100.             within a file.  For a communications port it returns the
  1101.             number of received characters waiting in the receive
  1102.             buffer.
  1103.  
  1104.  
  1105.  
  1106.           LOCATE row,column,[cursor]
  1107.  
  1108.             Positions the cursor on the screen.  If cursor is set to
  1109.             0 then the cursor is turned off.
  1110.  
  1111.  
  1112.  
  1113.           LPRINT expressionlist [,|;]
  1114.  
  1115.             Prints the items in expression list.  See PRINT for a
  1116.             more complete description.
  1117.                                       16
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.           LPRINT USING formatstring; expressionlist[,|;]
  1133.  
  1134.             The formatstring tells how to print the items in
  1135.             expressionlist.  See PRINT USING for a description of
  1136.             format string items.
  1137.  
  1138.  
  1139.  
  1140.           LSET stringvariable=string expression
  1141.  
  1142.             This command puts data into a random access file buffer.
  1143.             The buffer must be previously defined by a FIELD
  1144.             statement.  The data is left justified in the field.
  1145.  
  1146.               e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  1147.                     FIELD #1,18 AS NAME$,18 AS ADDRESS$
  1148.                     LSET NAME$="FRED SMITH"
  1149.                     LSET ADDRESS$="1 MAIN STRING"
  1150.                     PUT #1,4
  1151.                     CLOSE #1
  1152.  
  1153.  
  1154.  
  1155.           MAINMENU stringexpression,stringexpression...
  1156.  
  1157.             This command is ignored in DOS.  This command defines
  1158.             the main menu bar for Windows.  Up to six sub menu names
  1159.             may be specified.  If less than six are defined, blank
  1160.             strings must be present.  See the section 'Programming
  1161.             menus' for more detail.
  1162.  
  1163.               e.g. MAINMENU "File","Color","Options","","",""
  1164.  
  1165.  
  1166.  
  1167.           MENUITEMGRAY keycode
  1168.  
  1169.             This command is ignored in DOS.  This command 'grays' a
  1170.             submenu item.  While gray the item cannot be selected by
  1171.             the user.  See the section 'Programming menus' for more
  1172.             detail.
  1173.  
  1174.  
  1175.  
  1176.           MENUITEMON keycode
  1177.  
  1178.             This command is ignored in DOS.  This command enables a
  1179.             submenu item.  When enable a user may select this menu
  1180.             item.
  1181.  
  1182.  
  1183.                                       17
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.           MID$(stringexpression,n,length)
  1197.  
  1198.             This function returns a string composed of length
  1199.             characters starting with character n in
  1200.             stringexpression.
  1201.  
  1202.  
  1203.  
  1204.           MKDIR stringexpression
  1205.  
  1206.             This command creates a directory specified by
  1207.             stringexpression
  1208.  
  1209.  
  1210.  
  1211.           MOUSEB
  1212.  
  1213.             This function returns information on whether mouse
  1214.             buttons are pressed.  Bit 0 is 1 if left button is
  1215.             pressed.  Bit 1 is 1 if right button is pressed.  Bit 2
  1216.             is 1 if middle button is pressed.
  1217.  
  1218.               e.g.  b=mouseb
  1219.                     b=b and 2
  1220.                     if b<>0 then
  1221.                       print "right button is pressed."
  1222.                     end if
  1223.  
  1224.  
  1225.  
  1226.           MOUSEON
  1227.  
  1228.             This function intializes the mouse.  It returns a -1
  1229.             (true) if a mouse is present.  It returns 0 if no mouse
  1230.             is present.  This function must be issued before the
  1231.             mouse can be used in both DOS and Windows.
  1232.  
  1233.               e.g.  mouseflag=mouseon
  1234.  
  1235.  
  1236.  
  1237.           MOUSEX
  1238.  
  1239.             This function returns the x position of the mouse in
  1240.             character units (1 through 80).
  1241.  
  1242.               e.g. x=mousex
  1243.  
  1244.  
  1245.  
  1246.           MOUSEY
  1247.  
  1248.             This function returns the y position of the mouse in
  1249.                                       18
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.             character units (1 through 25).
  1262.  
  1263.               e.g.  y=mousey
  1264.  
  1265.  
  1266.  
  1267.           OPEN filename FOR access AS #
  1268.  
  1269.             This command prepares the file filename for access as
  1270.             number #.  Access types supported are INPUT, OUTPUT,
  1271.             APPEND, BINARY, RANDOM.  This is the only syntax form
  1272.             supported by BasicBasic
  1273.  
  1274.                  e.g.  OPEN "TEST.DAT" FOR INPUT AS #1
  1275.  
  1276.  
  1277.  
  1278.  
  1279.           OPEN "COMn: speed,parity,data,stop" FOR RANDOM AS #n LEN=n
  1280.  
  1281.             This statement opens and initializes a communications
  1282.             port.  COM1 and COM2 are supported.  Supported speeds
  1283.             are 9600, 4800,2400,1200,and 300.  Parity may be either
  1284.             E,O,N, or M.  Data may be either 5,6,7, or 8.  Stop may
  1285.             be either 1, 1.5, or 2.  LEN is used to specify the size
  1286.             of the input buffer.  The default is 128 bytes.  For
  1287.             Windows programs a minimum of 2048 is suggested.
  1288.  
  1289.             Only PRINT # will output characters to an open
  1290.             communications port.  Only INPUT$ will receive
  1291.             characters from a port.
  1292.  
  1293.             Communications parameters may be omitted; however, their
  1294.             position must be marked by commas.  Default parameters
  1295.             are 300 baud, No parity, 8 data bits, and 1 stop bit.
  1296.  
  1297.               e.g. OPEN "COM1: 2400,E,7,1" for random as #1 len=2048
  1298.  
  1299.             See the section "Communications Programming" for more
  1300.             details.
  1301.  
  1302.  
  1303.  
  1304.           OSTYPE
  1305.  
  1306.             This function returns a number indicating what operating
  1307.             system the program is running under.
  1308.  
  1309.                    1 - DOS
  1310.                    2 - Windows 3.x
  1311.                    3 - ?
  1312.  
  1313.  
  1314.  
  1315.                                       19
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.           POS(0)
  1328.  
  1329.             This function returns the current column position of the
  1330.             cursor.
  1331.  
  1332.  
  1333.  
  1334.           PRINT expressionlist [,|;]
  1335.  
  1336.             Prints the items in expression list.  PRINT with no
  1337.             expression results in a blank line being printed.  If
  1338.             the expression is followed by a semi-colon (;) the next
  1339.             print starts immediately following this one.  If the
  1340.             expression ends in a comma (,) the next print starts at
  1341.             the next print position.  Print positions are at columns
  1342.             1, 15, 29, etc.
  1343.  
  1344.  
  1345.  
  1346.           PRINT USING formatstring; expressionlist[,|;]
  1347.  
  1348.             The formatstring tells how to print the items in
  1349.             expressionlist.  Any text may be in formatstring.
  1350.             BasicBasic only recognizes three format characters.
  1351.             These are pound sign (#)  comma (,) and period (.).
  1352.             Each time a number character is found (#) one item from
  1353.             the expression list will be printed.
  1354.  
  1355.                e.g. PRINT USING "The answer is: ###,###.##";number
  1356.  
  1357.  
  1358.  
  1359.           PRINT #filenumber,expressonlist
  1360.  
  1361.             Prints to a file or communications port the items in
  1362.             expression list.
  1363.  
  1364.  
  1365.  
  1366.           PUT #filenumber,recordnumber,stringexpression
  1367.           PUT #filenumber,recordnumber
  1368.  
  1369.             This statement is used to output data to a file opened
  1370.             in either BINARY or RANDOM mode.
  1371.  
  1372.             In BINARY mode the string expression will be written to
  1373.             the file at the byte location given by recordnumber.
  1374.             Recordnumber is the absolute byte number to be written,
  1375.             where the first byte of the file is 1.
  1376.  
  1377.               e.g. A$=SPACE$(20)
  1378.                    PUT #1,100,A$  (writes 20 bytes starting at 100)
  1379.  
  1380.  
  1381.                                       20
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.             In RANDOM mode the data in the output buffer will be
  1394.             written to the record number indicated.
  1395.  
  1396.               e.g. PUT #1,1    (writes to record 1)
  1397.  
  1398.  
  1399.  
  1400.           RADIOON keycode
  1401.  
  1402.             This command 'checks' the indicated Radio button.  See
  1403.             the section "Programming Buttons" for more information.
  1404.  
  1405.  
  1406.  
  1407.           RADIOOFF keycode
  1408.  
  1409.             This command 'unchecks' the indicated Radio button.  See
  1410.             the section "Programming Buttons" for more information.
  1411.  
  1412.  
  1413.  
  1414.           READ variablelist
  1415.  
  1416.             Inputs a value from a DATA statement.
  1417.  
  1418.  
  1419.  
  1420.           REM
  1421.  
  1422.             Denotes a comment line and is ignored by the compiler.
  1423.  
  1424.  
  1425.  
  1426.           RESTORE label
  1427.  
  1428.             Sets position that next READ statement will input data
  1429.             from.
  1430.  
  1431.  
  1432.  
  1433.           RETURN
  1434.  
  1435.             Returns program execution to location immediately after
  1436.             last GOSUB.
  1437.  
  1438.  
  1439.  
  1440.           RIGHT$(stringexpression,n)
  1441.  
  1442.             This function returns a string of length n from the
  1443.             right part of stringexpression
  1444.  
  1445.  
  1446.  
  1447.                                       21
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.           RMDIR stringexpression
  1460.  
  1461.             This command removes the directory given by
  1462.             stringexpression.
  1463.  
  1464.  
  1465.  
  1466.           RND
  1467.  
  1468.             This function returns one in a sequence of random
  1469.             numbers between 0 and 1.
  1470.  
  1471.  
  1472.  
  1473.           SCROLLAREA leftx,topy,rightx,bottomy
  1474.  
  1475.             This statement defines an area of the screen which is
  1476.             used for scrolling.  This allows you to create fixed
  1477.             text or buttons in one area of the screen while
  1478.             scrolling another area.  Leftx, topy, rightx, bottomy
  1479.             are in character units and are inclusive.
  1480.  
  1481.             Executing the CLS command will clear the entire screen,
  1482.             not just the scrollable area.  PRINT CHR$(12); will only
  1483.             clear the scrollable area.
  1484.  
  1485.  
  1486.  
  1487.           SETCOM comnum,"Speed,Parity,Databits,Stopbits,dtr,rts"
  1488.  
  1489.             This statement allows you to change communications
  1490.             parameters for an already opened communications port.
  1491.             Speed, Parity, Databits, and Stopbits are described in
  1492.             OPEN COM.  DTR may be either ON or OFF.  If ON then the
  1493.             output data terminal ready signal will be set high.  ON
  1494.             is the default.  RTS may be either 1 or 0.  If 1 then
  1495.             the output request to send is high.  1 is the default.
  1496.             Communications parameters not present will not be
  1497.             changed; however, a comma must mark their positions.
  1498.  
  1499.                e.g. SETCOM 1,",,7"
  1500.  
  1501.                      Sets number of data bits to 7.
  1502.  
  1503.                e.g. SETCOM 1,",,,,OFF"
  1504.  
  1505.                     Turns Data terminal read;y off.
  1506.  
  1507.             See the section "Communications Programming" for more
  1508.             information.
  1509.  
  1510.  
  1511.  
  1512.           SETERRLEVEL level
  1513.                                       22
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.             This command defines what BasicBasic should do in case
  1527.             of runtime errors.  Level must be a number (not an
  1528.             expression or variable).  Level 7 causes execution to
  1529.             halted for all errors.  Level 5 causes execution to
  1530.             continue for recoverable errors.  In the latter case the
  1531.             global variable ERR is set to the error number.  ERR may
  1532.             be reset with the statement:  ERR=0.  ERR will be reset
  1533.             each time an error occurs so the program must check ERR
  1534.             immediately after statements which may produce errors.
  1535.  
  1536.  
  1537.  
  1538.           SPACE$(N)
  1539.  
  1540.             Returns a string of n spaces.
  1541.  
  1542.  
  1543.  
  1544.           STOP
  1545.  
  1546.             Causes the program to cease execution.
  1547.  
  1548.  
  1549.  
  1550.           STR$(numericexpression)
  1551.  
  1552.            This function returns a string representation of the
  1553.            numbericexpression.
  1554.  
  1555.  
  1556.  
  1557.           STRING$(m,stringexpression)
  1558.  
  1559.             This function returns a string of length n.  This string
  1560.             is composed of the first character in stringexpression.
  1561.  
  1562.  
  1563.  
  1564.           TAB(numericexpression)
  1565.  
  1566.             In PRINT or LPRINT statements positions output at column
  1567.             position given in numericexpression.
  1568.  
  1569.  
  1570.  
  1571.           TIME$
  1572.  
  1573.             This function returns a string representation of the
  1574.             current system time.
  1575.  
  1576.  
  1577.  
  1578.           TIMER
  1579.                                       23
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.             This function returns the number of seconds since
  1593.             midnight.
  1594.  
  1595.  
  1596.  
  1597.           UCASE$(stringexpression)
  1598.  
  1599.             This function converts all lower case characters in
  1600.             stringexpression to upper case and returns as new
  1601.             string.
  1602.  
  1603.  
  1604.  
  1605.           VAL(stringexpression)
  1606.  
  1607.             This function returns the numeric value of string
  1608.             stringexpression.
  1609.  
  1610.  
  1611.  
  1612.           WRITE #filenumber,expression list
  1613.  
  1614.             Write is performs the same way as Print with these
  1615.             exceptions:  1) Commas are inserted between all items;
  1616.             2) Strings are bracketed by quotation marks.
  1617.  
  1618.             BasicBasic does not support using the Write statement to
  1619.             display on the screen.
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.                                       24
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.           WINDOWS AND FONTS
  1659.           -------------------------------------------------------
  1660.  
  1661.           The following discussion is current for Windows Version
  1662.           3.1.  The concepts discussed are applicable for Version
  1663.           3.0, however, font file names are different for that
  1664.           version.
  1665.  
  1666.           BasicBasic selects the OEM Fixed font closest in size to
  1667.           the system font size used in menus, buttons, etc.  If you
  1668.           desire a different font size when running a BasicBasic
  1669.           program you can select from available fonts in the System
  1670.           Menu.  You may also mark a given font size to be the new
  1671.           default for that program.
  1672.  
  1673.           Depending on how you configured your system there may be
  1674.           only one OEM font installed.  Windows 3.1 comes with an
  1675.           assortment of OEM fonts.  The file DOSAPP.FON contains the
  1676.           fonts used by Windows to run DOS in a window and are good
  1677.           for use with BasicBasic.  If this file is not in you
  1678.           windows system directory (e.g. WINDOWS\SYSTEM) then your
  1679.           can copy it from your distributions disks and then use the
  1680.           Control Panel Fonts accessory to install them (These fonts
  1681.           have the name 'MS-DOS CP 437').
  1682.  
  1683.           IMPORTANT INFORMATION FOR 386 ENHANCED MODE:  If you use
  1684.           the MS-DOS prompt in 386 Enhanced mode you will need to
  1685.           make a change in your SYSTEM.INI file to use multiple size
  1686.           fonts in BasicBasic.  As mentioned previously Windows does
  1687.           not normally permanently install the fonts from
  1688.           DOSAPP.FON.  As was indicated you can do this from the
  1689.           Control Panel Fonts accessory.  HOWEVER, you will find
  1690.           that each time you EXIT the MS-DOS prompt these fonts will
  1691.           be REMOVED from the system.  This is because Windows does
  1692.           not expect these fonts to be present and there is a
  1693.           control line in SYSTEM.INI which explicitly tells it to
  1694.           load and unload them when running the MS-DOS prompt.  Once
  1695.           you have installed these fonts you can keep Windows from
  1696.           un-installing them by removing the following line from the
  1697.           [386Enh] section of SYSTEM.INI:
  1698.  
  1699.                    WOAFONT=DOSAPP.FON
  1700.  
  1701.  
  1702.           FONTS AND BUTTONS: This discussion applies only to buttons
  1703.           which are defined by the user to be one line high.  If you
  1704.           select a font smaller than the system font for use in a
  1705.           BasicBasic program the text in any buttons you have would
  1706.           be too crowded in the button space available.   BasicBasic
  1707.           corrects this problem in one of two ways.  1) If you
  1708.           system font is only slightly larger than the font selected
  1709.           in BasicBasic then any text in the buttons will be made
  1710.           all upper case so no 'descenders' will be outside the
  1711.                                       25
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.           button area.  2) If the system font is quite a bit larger
  1724.           than the selected font then BasicBasic will not use the
  1725.           standard Windows button design.  Instead it will draw a
  1726.           'simplified' button which can hold the small text of the
  1727.           font.
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.                                       26
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.           PROGRAMMING BUTTONS
  1791.           -------------------------------------------------------
  1792.           
  1793.           Buttons can be used in either DOS or Windows.  Buttons do
  1794.           not require the presence of a mouse.  Here is an example
  1795.           of a valid create button command:
  1796.  
  1797.               CBUTTON "EXIT",1068,0,"Push",0,1,1,8,1,7,4
  1798.  
  1799.           Here is a description of each parameter:
  1800.  
  1801.             EXIT - This is the name displayed in the button
  1802.  
  1803.             1068 - This is keycode for F10 (User can either
  1804.                    use mouse to push button or press F10.
  1805.  
  1806.             0    - Reserved
  1807.  
  1808.             Push - Type of button.  'Radio' is the other type.
  1809.  
  1810.             0    - Reserved
  1811.  
  1812.             1    - Left position
  1813.  
  1814.             1    - Y position
  1815.  
  1816.             8    - x size (in characters)
  1817.  
  1818.             1    - y size (in characters)
  1819.  
  1820.             7    - foreground color (In Windows only used for Radio
  1821.                    buttons).
  1822.  
  1823.             4    - background color (In Windows only used for Radio
  1824.                    buttons).
  1825.  
  1826.           In DOS a push button will have text centered and if the
  1827.           defined text size is at least 2 characters smaller than
  1828.           the button size a line will be drawn around the outside.
  1829.  
  1830.           Remember that if a mouse is going to be used it MUST be
  1831.           turned on with the MOUSEON function before it can be used
  1832.           to press a button.
  1833.  
  1834.           Here is an example of a small program which uses buttons:
  1835.  
  1836.                 A=MOUSEON
  1837.                 IF A=-1 THEN
  1838.                   CBUTTON "EXIT",1068,0,"PUSH",0,70,1,8,1,0,0
  1839.                 ELSE
  1840.                   CBUTTON "F10-Exit",1068,0,"PUSH",0,70,1,10,1,0,0
  1841.                 END IF
  1842.                 INPUT Z
  1843.                                       27
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.                 a$=INKEY$
  1856.                 PRINT LEN(A$)
  1857.  
  1858.             This program displays different text in the button
  1859.             depending on whether a mouse is present or not.
  1860.             Assuming there is a mouse this program will end under
  1861.             the following conditions:
  1862.  
  1863.                - User presses EXIT button with mouse
  1864.                - User presses F10 on keyboard
  1865.                - User presses ENTER key on keyboard.
  1866.  
  1867.             In the first two cases the print will show a length of 2
  1868.             for the length of A$ since the button keycode will be
  1869.             returned on the next INKEY$ after the INPUT is
  1870.             terminated.
  1871.  
  1872.           Once you have created a button you are responsible for NOT
  1873.           writing anything to that area of the screen.  If you do
  1874.           the button will be erased.  If you are using buttons and
  1875.           scrolling text on the screen make sure you use the
  1876.           SCROLLAREA command to protect the button area of the
  1877.           screen.
  1878.  
  1879.           INVISIBLE buttons can be particularly useful.  An
  1880.           invisible button does not appear on the screen, but a
  1881.           button push inside it's defined area will return it's
  1882.           keycode just as if it were.  This allows you to create
  1883.           your own special color buttons or input areas.  For
  1884.           instance you could have a series of INPUT statements in a
  1885.           program and each could be defined as an invisible button.
  1886.           When the user clicked on that input area you would get a
  1887.           unique keycode which would direct your program to the
  1888.           section of code which handles that input.
  1889.  
  1890.           Since buttons end INPUT commands you can also use
  1891.           invisible buttons to define any keys you want to end INPUT
  1892.           commands (e.g. UP ARROW or DOWN ARROW).
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.                                       28
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.           PROGRAMMING MENUS
  1923.           -------------------------------------------------------
  1924.           
  1925.           Menus are not supported in DOS.  Menu commands are ignored
  1926.           when running under DOS.
  1927.  
  1928.           Menus support in BasicBasic is much like button support.
  1929.           When the user selects a menu item a defined keycode is
  1930.           returned to the Basic program.  Menu keycodes are returned
  1931.           only using the INKEY$ function call.  However, if the user
  1932.           selects a menu item while the program is waiting for input
  1933.           in an INPUT command the input command will be terminated
  1934.           just as if the user had pressed Enter.  Then on the next
  1935.           INKEY$ call the keycode for the menu item will be
  1936.           returned.
  1937.  
  1938.           KEYCODES:  Just as in buttons keycodes can be regular or
  1939.           extend keys.  Extended keys are indicated by adding 1000
  1940.           to the regular keycode.  F10 would be 1068.  See the
  1941.           Appendix 'Keyboard codes' for a complete list.
  1942.  
  1943.           The mouse must be enable with the MOUSEON command before
  1944.           any menu items will be recognized.
  1945.  
  1946.           Here is an example of a simple Windows program which
  1947.           utilizes menus.
  1948.  
  1949.                 y=mouseon
  1950.                 mainmenu "Color","","","","",""
  1951.                 addsubmenu 1,"Black",1059
  1952.                 addsubmenu 1,"White",1061
  1953.                 backcolor=0
  1954.                 menuitemgray 1059
  1955.              50
  1956.                 cls
  1957.                 color 1,backcolor
  1958.                 locate 10,30
  1959.                 print "Sample text..";
  1960.              100
  1961.                 a$=inkey$
  1962.                 if a$="" then goto 100
  1963.                 if len(a$)=1 then goto 100
  1964.                 if right$(a$,1)=chr$(59)
  1965.                   menuitemon 1060
  1966.                   menuitemgray 1059
  1967.                   backcolor=7
  1968.                   goto 50
  1969.                 elseif right$(a$,1)=chr$(60)
  1970.                   menuitemon 1059
  1971.                   menuitemgray 1060
  1972.                   backcolor=0
  1973.                   goto 50
  1974.                 end if
  1975.                                       29
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.                 goto 100
  1988.  
  1989.           This program defines one menu and then adds two items to
  1990.           it.  These menu items allow the user to clear the screen
  1991.           to either black or white.  The program disables the menu
  1992.           item for whatever color the screen currently is.
  1993.  
  1994.           The menu could be define in the following way also.
  1995.  
  1996.                   mainmenu "&Color","","","","",""
  1997.                   addsubmenu 1,"&Black",1059
  1998.                   addsubmenu 1,"&White",1061
  1999.  
  2000.           The apersand (&) allows you to define which character in
  2001.           the menu will be underlined which allows the user to
  2002.           select this item by pressing the ALT key and this letter.
  2003.           This IS NOT the keycode which will be returned to your
  2004.           program.  This keycode will always be the one given as the
  2005.           last parameter of the addsubmenu command.
  2006.  
  2007.           We could also define the menu like this:
  2008.  
  2009.                   mainmenu "&Color","","","","",""
  2010.                   addsubmenu 1,"&Black",1059
  2011.                   addsubmenu 1,"",0
  2012.                   addsubmenu 1,"&White",1061
  2013.  
  2014.           The 3rd line (addsubmenu 1,"",0) creates a line seperator
  2015.           in the menu bar.  It can not be selected by the user.
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.                                       30
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.           COMMUNICATIONS PROGRAMMING
  2055.           -------------------------------------------------------
  2056.  
  2057.           Here is a brief example of using a communications port.
  2058.  
  2059.             rem
  2060.             rem open communications port
  2061.             rem
  2062.             OPEN "COM1: 2400,N,8" FOR RANDOM AS #1 LEN=2048
  2063.  
  2064.           100
  2065.  
  2066.             rem
  2067.             rem get input from communications port
  2068.             rem
  2069.             t = LOC(1)
  2070.             IF t > 0 THEN
  2071.               a$=input$(t,1)
  2072.               if len(a$)>0 then
  2073.                 rem come here to display received characters
  2074.                 PRINT a$;
  2075.  
  2076.               ELSE
  2077.                 rem come here if some kind of comm error that kept
  2078.                 rem us from getting the waiting character.
  2079.  
  2080.               end if
  2081.  
  2082.             END IF
  2083.  
  2084.             rem
  2085.             rem get input from keyboard
  2086.             rem
  2087.  
  2088.             b$ = INKEY$
  2089.  
  2090.             IF b$ <> "" THEN
  2091.  
  2092.                 PRINT #1, b$;
  2093.  
  2094.             END IF
  2095.  
  2096.             GOTO 100
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.                                       31
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.           CHAINING AND COMMON
  2122.           -------------------------------------------------------
  2123.  
  2124.           Here are examples of two programs, CHAIN1 and CHAIN2,
  2125.           which pass variables back and forth in common.
  2126.  
  2127.  
  2128.               CHAIN1
  2129.  
  2130.                   common a,b,c,d$(),c()
  2131.                   if a=0 then
  2132.                     cls
  2133.                     a=1
  2134.                     dim d$(10)
  2135.                     dim c(20)
  2136.                     d$(5)="This is d$(5)"
  2137.                   end if
  2138.                   print "press any key to go to chain 2"
  2139.                 100
  2140.                   a$=inkey$
  2141.                   if a$="" then goto 100
  2142.                   chain "chain2.exe"
  2143.  
  2144.  
  2145.               CHAIN2
  2146.  
  2147.                   common a,b,c,d$(),c()
  2148.                   b=b+1
  2149.                   print "this is chain 2"
  2150.                   print "b=";b;
  2151.                   print d$(5)
  2152.                   input z
  2153.                   chain "chain1.exe"
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.                                       32
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.           ERROR MESSAGES
  2187.           -------------------------------------------------------
  2188.           
  2189.           Compile errors will give a description of the problem and
  2190.           display the line where the error occurred.
  2191.  
  2192.           Runtime errors are divided into two classes.  Fatal errors
  2193.           always cause execution of the program to cease.
  2194.           Recoverable errors cause program execution to cease if
  2195.           SETERRLEVEL is 7, overwise execution continues and the
  2196.           error number is placed in the system variable ERR.
  2197.           SETERRLEVEL 7 is the default.
  2198.  
  2199.           When runtime errors are displayed they are accompanied by
  2200.           a runtime address.  The compiler will optionally output a
  2201.           list of runtime addresses for each statement.  These
  2202.           addresses will be contained in a file with the same name
  2203.           as the source file and an extension of .TMP.  In Windows
  2204.           you select debug output by selecting the Debug Output box.
  2205.           In the DOS version of the compiler you select debug output
  2206.           by putting a /D in the command line (e.g. BB MYPROG /D).
  2207.  
  2208.           Fatal Errors:
  2209.  
  2210.                error number              description
  2211.                ------------              -----------
  2212.  
  2213.                   503         READ is attempting to read wrong kind
  2214.                               of data.
  2215.                   501
  2216.                   ...
  2217.                   522         Internal runtime errors.
  2218.                   523         Wrong number of array elements or
  2219.                               array not dimensioned.
  2220.                   524         Out of free space.
  2221.                   525         Out of string space.
  2222.  
  2223.           Recoverable Errors:
  2224.  
  2225.                   1000        Error attempting to open file
  2226.                   1001        Attempt to read past end of file
  2227.                   1002        File not open
  2228.                   1003        File read error (probably hardware)
  2229.                   1004        ASC function on empty string
  2230.                   1005        Divide by zero
  2231.                   1006        Out of data during READ
  2232.                   1007        File already open
  2233.                   1008        No available file control block
  2234.                   1009        Error attempting to open file
  2235.                   1010        File mode error on read
  2236.                   1011        File mode error on write
  2237.                   1012        Bad file number
  2238.                   1013        Path not found
  2239.                                       33
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.                   1014        RMDIR error
  2252.                   1015        MKDIR error
  2253.                   1016        KILL error
  2254.                   1017        FILE BUFFER ERROR
  2255.                   1018        INVALID FIELD DATA
  2256.                   1019        FIELD OVERFLOW
  2257.                   1020        FILE ERROR
  2258.                   1021        COMMUNICATIONS OPEN ERROR
  2259.                   1022        CREATE BUTTON ERROR
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.                                       34
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.           KEYBOARD CODES
  2319.           -------------------------------------------------------
  2320.  
  2321.           The following table shows the key codes returned by the
  2322.           INKEY$ function.  These key codes are returned as 1 byte.
  2323.  
  2324.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  2325.                  KEY CODE        KEY CODE        KEY CODE
  2326.             ESC    27                       BKSP    8
  2327.             1      49        !     33       TAB     9
  2328.             2      50        @     64       ENTER   13
  2329.             3      51        #     35       SPACE   32
  2330.             4      52        $     36
  2331.             5      53        %     37
  2332.             6      54        ^     94
  2333.             7      55        &     38
  2334.             8      56        *     42
  2335.             9      57        (     40
  2336.             0      48        )     41
  2337.             -      45        _     95
  2338.             =      61        +     43
  2339.  
  2340.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  2341.                  KEY CODE        KEY CODE        KEY CODE
  2342.              A     65        a     97
  2343.              B     66        b     98
  2344.              C     67        c     99
  2345.              D     68        d     100
  2346.              E     69        e     101
  2347.              F     70        f     102
  2348.              G     71        g     103
  2349.              H     72        h     104
  2350.              I     73        i     105
  2351.              J     74        j     106
  2352.              K     75        k     107
  2353.              L     76        l     108
  2354.              M     77        m     109
  2355.              N     78        n     110
  2356.              O     79        o     111
  2357.              P     80        p     112
  2358.              Q     81        q     113
  2359.              R     82        r     114
  2360.              S     83        s     115
  2361.              T     84        t     116
  2362.              U     85        u     117
  2363.              V     86        v     118
  2364.              W     87        w     119
  2365.              X     88        x     120
  2366.              Y     89       y      121
  2367.              Z     90       z      122
  2368.  
  2369.  
  2370.  
  2371.                                       35
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.           The following table shows the extended key codes returned
  2384.           by the INKEY$ function.  These key codes are returned as 2
  2385.           characters.  In this case the first character will be 0.
  2386.           
  2387.                     KEY   DECIMAL
  2388.                           KEY CODE
  2389.                     ----  ------
  2390.                      F1    0 59
  2391.                      F2    0 60
  2392.                      F3    0 61
  2393.                      F4    0 62
  2394.                      F5    0 63
  2395.                      F6    0 64
  2396.                      F7    0 65
  2397.                      F8    0 66
  2398.                      F9    0 67
  2399.                      F10   0 68
  2400.  
  2401.                      CTRL-F1   0   94
  2402.                      CTRL-F2   0   95
  2403.                      CTRL-F3   0   96
  2404.                      CTRL-F4   0   97
  2405.                      CTRL-F5   0   98
  2406.                      CTRL-F6   0   99
  2407.                      CTRL-F7   0  100
  2408.                      CTRL-F8   0  101
  2409.                      CTRL-F9   0  102
  2410.                      CTRL-F10  0  103
  2411.                      SHIFT-F1  0   84
  2412.                      SHIFT-F2  0   85
  2413.                      SHIFT-F3  0   86
  2414.                      SHIFT-F4  0   87
  2415.                      SHIFT-F5  0   88
  2416.                      SHIFT-F6  0   89
  2417.                      SHIFT-F7  0   90
  2418.                      SHIFT-F8  0   91
  2419.                      SHIFT-F9  0   92
  2420.                      SHIFT-F10  0  93
  2421.                      HOME       0  71
  2422.                      UP ARROW   0  72
  2423.                      PGUP       0  73
  2424.                      LEFT ARROW 0  75
  2425.                      RIGHT ARR  0  77
  2426.                      END        0  79
  2427.                      DOWN ARROW 0  80
  2428.                      PGDN       0  81
  2429.                      INS        0  82
  2430.                      DEL        0  83
  2431.                      CTRL-HOME  0  119
  2432.                      CTRL-PGUP  0  132
  2433.                      CTRL-LEFT  0  115
  2434.                      CTRL-RIGHT 0  116
  2435.                      CTRL-END   0  117
  2436.                      CTRL-PGDN  0  118
  2437.                                       36
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.           BasicBasic is copyright (c) 1992 by Mark Davidsaver
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.           Windows is a registered trademark of Microsoft
  2452.           Corporation.
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                                       37
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.